package com.leen.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.leen.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 后台用户信息表
 * @author yy
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "后台用户信息表模型")
@Table(name = "sys_admin")
@Entity
public class Admin extends BaseEntity implements Serializable {
    /**
     * 后台用户ID
     */
    @ApiModelProperty(value = "后台用户ID",example = "0")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "admin_id")
    private Integer adminId;

    /**
     * 用户账号
     */
    @ApiModelProperty(value = "用户账号")
    @Column(name = "login_name",unique = true)
    @NotBlank(message = "用户账号不能空")
    private String loginName;

    /**
     * 手机号码
     */
    @ApiModelProperty(value = "手机号码")
    @Column(name = "mobile",unique = true)
    @NotBlank(message = "手机号码不能空")
    private String  mobile;

    /**
     * 用户性别
     */
    @ApiModelProperty(value = "用户性别",example = "0")
    @Column(name = "sex")
    @NotNull(message = "手机号码不能空")
    private Integer  sex;

    /**
     * 头像地址
     */
    @ApiModelProperty(value = "头像地址")
    @Column(name = "avatar")
    private String  avatar;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    @Column(name = "password",nullable = false)
    @NotBlank(message = "密码不能空")
    private String password;

    /**
     * 帐号状态
     */
    @ApiModelProperty(value = "帐号状态")
    @Column(name = "status",nullable = false)
    @NotNull(message = "帐号状态不能空")
    private Integer status;

    /**
     * 最后登陆IP
     */
    @ApiModelProperty(value = "最后登陆IP")
    @Column(name = "login_ip")
    private String  loginIp;

    /**
     * 最后登陆时间
     */
    @JSONField(format = "yyyy-MM-dd")
    @ApiModelProperty(value = "最后登陆时间")
    @Column(name = "login_date")
    private Date loginDate;



}
